﻿@model SensitiveWordTypeEditModel
@using (Html.BeginAjaxForm("_AddSensitiveWordType", "ControlPanelSettings", null, FormMethod.Post, new AjaxFormOptions { OnSuccessCallBack = "success", OnErrorCallBack = "error" }, new { id = "AddSensitiveWordTypeForm" }))
{ 
    @Html.HiddenFor(n => n.TypeId)
    <div class="tnc-dailog-pd">
        <div class="tn-form tn-label-right tnc-label-short">
            <div class="tn-form-row">
                @Html.FormLabelFor(n => n.Name)
                @Html.TextBoxFor(n => n.Name, InputWidthTypes.Medium)               
                @Html.ValidationMessageFor(n => n.Name)
            </div>            
        </div>
    </div>
    <div class="tnc-artdilog-btn tn-border-gray tn-border-top tn-bg-gray">
        @Html.Button("确认", ButtonTypes.Submit, HighlightStyles.Primary)
        @Html.Button("取消", ButtonTypes.Cancel, HighlightStyles.Secondary, htmlAttributes: new { dialogOperation = "close" })
    </div>
}
<script type="text/dialog">
       this.title("@(Model.TypeId > 0 ? "编辑敏感词分类" : "添加敏感词分类")");
</script>
<script type="text/javascript">
    function success(data) {
        if (data.MessageType == 1) {
            art.dialog.tips(data.MessageContent, 1.5, data.MessageType, function () { window.location.reload(true) });
        } else {
            art.dialog.tips(data.MessageContent, 1.5, data.MessageType);
        }
    }
    function error(reponse) {
        $("#AddSensitiveWordTypeForm").replaceWith(reponse);
    }
</script>